package com.mashibing.test.singleton;

/**
 * @author: mayu
 * @date: 2021年05月18日 16:29
 * 饿汉式
 */
public class S1 {
    private static final S1 INSTANCE = new S1();

    private S1() {
    }

    /**
     *   
     * @return com.mashibing.test.singleton.S1
     */
    public static S1 getInstance() {
        return INSTANCE;
    }

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            new Thread(() -> {
                System.out.println(Thread.currentThread().getName() + "：" + S1.getInstance().hashCode());
            }).start();
        }
    }
}
